<?php 
class __RENDER {
	private static $_instance;
	private $_layout;
	private $_groupLayout = 'default';
	
	public static function getInstance() {
		if (!self::$_instance) self::$_instance = new self();

		return self::$_instance;
	}

	public function __construct() {
		// set layout
		$this->_layout = __LAYOUT::getInstance();
		//$this->_layout->setGroupLayout(__SYSTEM::getInstance()->getOption('layout_group'));
		$this->_layout->setGroupLayout($this->_groupLayout);
	}
	
	public function render($layoutName, $options = array()) {
		return $this->_layout->loadLayout($layoutName, $options);
	}
	
	public function setGroupLayout($groupLayoutName) {
		$this->_groupLayout = $groupLayoutName;
		$this->_layout->setGroupLayout($this->_groupLayout);
	}
	
	public static function view($contents) {
	/*	self::sendHeader();
		if (__SYSTEM::getInstance()->getOption('rewrite')) {
			__REWRITE::rewritePageLink($contents);
		}
	*/	
		echo $contents;
	}
}